#include "Frame.h"
#include <stdio.h>


//default constructor
Frame::Frame()
{
}

//overloaded constructor
Frame::Frame(int who, int dest, bool isData, int msg, int check_seq)
{
    
    sender = who;
    destinationer = dest;
    if(isData)
    {
        frameType = DATA_FRAME;
    }
    else
    {
        frameType = ACK_FRAME;
    }
    
    sprintf(message, "%d", msg);

    frame_check_sequence = check_seq;
}

int Frame::getSender()
{
    return sender;
}

int Frame::getDestinationer()
{
    return destinationer;
}

int Frame::getFrameType()
{
    return frameType;
}

char* Frame::getMessage()
{
    return message;
}

int Frame::getFCS()
{
    return frame_check_sequence;
}

void Frame::setSender(int who)
{
    sender = who;
}

void Frame::setDestinationer(int dest)
{
    destinationer = dest;
}

void Frame::setFrameType(int fType)
{
    frameType = fType;
}

void Frame::setMessage(char msg[])
{
    sprintf(message, "%s", msg);
}

void Frame::setFCS(int seq)
{
    frame_check_sequence = seq;
}